//导入express框架
const express = require('express')
//创建路由器
const r = express.Router();
//调用连接池模块
const pool = require('../pool.js');
//创建路由
r.post('/Login',(req,res,next)=>{
  //console.log(req)
  var obj = req.body
  //console.log(req.body)
  var sql = `select * from admin where a_names="${obj.aname}" and a_pwd="${obj.apwd}"`;
  pool.query(sql,(err,data)=>{
    if(err){next(err);return}
    console.log(data)
    if(data.length==0){
      res.send({code:0,msg:'登录失败'})
    }else{
      res.send({code:1,msg:'登录成功'})
    }

  })
})
//
//
//导出路由器
module.exports=r;